package demo4;


//// 利用lambda 表达式来实现 Runnable
public class Test6 {
    public static void main(String[] args) {


        Thread t=new Thread(new Runnable() {
            @Override
            public void run() {
                    while(true) {
                        System.out.println("this is lambdaRunnable");
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                    }
                }

        });
        t.start();

        while(true) {
            System.out.println("this is mainRunnable");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
